/*
//		HEAPSIZE.C - Paradigm C++ Heap Sizing Module
//
//		This module is included in a project to customize the size of the
//		application heaps.  Setting the macro HEAPSIZE to the desired size of the
//		default heap (in KB) is all this is required.
//
//		In compact, large, and huge memory models there is only a single heap
//		that is outside the default data segment and the size is selected by
//		the macro HEAPSIZE.
//
//		In small and medium memory models, you have the option of having two
//		heaps, the default heap which is part of DGROUP (and therefore is limited
//		to a maximum size of 64KB), and a far heap that can use the available RAM
//		in a system.  In this case HEAPSIZE selects the size of the default heap
//		and FHEAPSIZE selects the size of the far heap.
//
//		From the IDE, just add the define HEAPSIZE='###' to the HEAPSIZE.C node
//		to get the desired size.
*/

#if	!defined(HEAPSIZE)				/* HEAPSIZE sets the size of the default heap */
#define	HEAPSIZE			16				/* Create a default 16KB heap */
#endif

#if	!defined(FHEAPSIZE)				/* FHEAPSIZE sets the size of the far heap */
#define	FHEAPSIZE		0				/* Create a default 0KB far heap */
#endif

/*
//		Select the default heap and the far heap sizes
*/

#if	defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
#define	NEARHEAP			0
#define	FARHEAP			HEAPSIZE
#else
#define	NEARHEAP			HEAPSIZE
#define	FARHEAP			FHEAPSIZE
#endif


/*
//		Do some error checking on the heap selections - no user customization
//		beyond this point unless you know what you are doing.
*/

#if	NEARHEAP > 0 && (defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__))
#error Near heap not supported in far data memory models
#endif

#if NEARHEAP > 0
#if NEARHEAP >= 64
#error Near heap size must be less than 64KB
#else
#if defined(__FARBSS__) && (__FARBSS__ == 1)
#pragma option -zX_NHEAP -zYSTACK -zZDGROUP
#else
#pragma option -zE_NHEAP -zFSTACK -zHDGROUP
#endif
unsigned char __huge theNearHeap[NEARHEAP * 1024UL] ;
#if defined(__FARBSS__) && (__FARBSS__ == 1)
#pragma option -zX* -zY* -zZ*
#else
#pragma option -zE* -zF* -zH*
#endif
#endif
#endif

#if	FARHEAP > 0
#if	FARHEAP >= 1024 && !defined(__EXTADDR__)
#error	Far heap must be less than 1024KB
#else
#if defined(__FARBSS__) && (__FARBSS__ == 1)
#pragma option -zX* -zYFAR_HEAP -zZ*
#else
#pragma option -zE* -zFFAR_HEAP -zH*
#endif
unsigned char __huge theFarHeap[FARHEAP * 1024UL] ;
#if defined(__FARBSS__) && (__FARBSS__ == 1)
#pragma option -zX* -zY* -zZ*
#else
#pragma option -zE* -zF* -zH*
#endif
#endif
#endif
